#include <reg52.H>
#include "Delay.h"

sbit W = P3^0 ;
sbit E = P3^1 ;
sbit R = P3^2 ;
sbit T = P3^3 ;

int key()
{
	unsigned char KeyNum=0;
		if(E==0){Delay(20);while(E==0);Delay(20);KeyNum=1;}
		if(W==0){Delay(20);while(W==0);Delay(20);KeyNum=2;}
		if(R==0){Delay(20);while(R==0);Delay(20);KeyNum=3;}
		if(T==0){Delay(20);while(T==0);Delay(20);KeyNum=4;}
		return KeyNum;
	}